using EPiServer.Common.Security;
using EPiServer.Community.Blog.Security;

namespace EPiAbstractions.Community.Blog.Security
{
    public class SecurityHandlerFacade : ISecurityHandlerFacade
    {
        private static SecurityHandlerFacade _instance;

        public static SecurityHandlerFacade Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new SecurityHandlerFacade();

                return _instance;
            }

            set { _instance = value; }
        }

        #region ISecurityHandlerFacade Members

        public virtual UserCollection GetBlogUsers(EPiServer.Community.Blog.Blog blog)
        {
            return SecurityHandler.Instance.GetBlogUsers(blog);
        }

        public virtual GroupCollection GetBlogGroups(EPiServer.Community.Blog.Blog blog)
        {
            return SecurityHandler.Instance.GetBlogGroups(blog);
        }

        public virtual void SetBlogAccessRights(EPiServer.Community.Blog.Blog blog, IUser user, BlogAccessRights rights)
        {
            SecurityHandler.Instance.SetBlogAccessRights(blog, user, rights);
        }

        public virtual void SetBlogAccessRights(EPiServer.Community.Blog.Blog blog, IGroup group, BlogAccessRights rights)
        {
            SecurityHandler.Instance.SetBlogAccessRights(blog, group, rights);
        }

        public virtual BlogAccessRights GetBlogAccessRights(EPiServer.Community.Blog.Blog blog, IUser user)
        {
            return SecurityHandler.Instance.GetBlogAccessRights(blog, user);
        }

        public virtual BlogAccessRights GetBlogAccessRights(EPiServer.Community.Blog.Blog blog, IGroup group)
        {
            return SecurityHandler.Instance.GetBlogAccessRights(blog, group);
        }

        public virtual void RemoveBlogAccessRights(EPiServer.Community.Blog.Blog blog, IUser user)
        {
            SecurityHandler.Instance.RemoveBlogAccessRights(blog, user);
        }

        public virtual void RemoveBlogAccessRights(EPiServer.Community.Blog.Blog blog, IGroup group)
        {
            SecurityHandler.Instance.RemoveBlogAccessRights(blog, group);
        }

        public virtual void RemoveBlogAccessRights(EPiServer.Community.Blog.Blog blog)
        {
            SecurityHandler.Instance.RemoveBlogAccessRights(blog);
        }

        public virtual BlogAccessRights GetTotalBlogAccessRights(EPiServer.Community.Blog.Blog blog, IUser user)
        {
            return SecurityHandler.Instance.GetTotalBlogAccessRights(blog, user);
        }

        public virtual BlogAccessRights GetTotalBlogAccessRights(EPiServer.Community.Blog.Blog blog, IGroup group)
        {
            return SecurityHandler.Instance.GetTotalBlogAccessRights(blog, group);
        }
        #endregion
    }
}